<template>
  <!-- 二维吗登录 -->
  <div class="container">
    <h1 class="title">微信扫码登录</h1>
    <div class="img" v-loading="false">
      <!-- v-loading="true" -->
      <img src="../../assets/二维码.png" alt="" width="200px" />
      <i class="mask"></i>
    </div>
    <p>
      <svg aria-hidden="true" class="icon-wx">
        <use xlink:href="#icon-weixin"></use>
      </svg>
      <b>扫描二维码</b>
    </p>
  </div>
</template>
<script setup>
import * as api from "@/api/users";

//引入socket.io
import socketIo from "socket.io-client";
//引入qrcode
// import qr from "qrcode";
import { onBeforeMount, watchEffect } from "vue";
onBeforeMount(() => {});

//建立socket连接
let io = socketIo("wss://chst.vip");
console.log(io.__proto__.__proto__.on);
//监听连接的事件
// io.__proto__.__proto__.on("connectSuccess", (sid) => {
//   console.log(sid);
// });
</script>
<style scoped lang="scss">
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  box-shadow: 0 0 10px 1px white;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  border-radius: 10px;
  width: 350px;
  padding: 20px;
  height: 350px;
  overflow: hidden;
  background-color: rgba(17, 16, 16, 0.2);
  :deep(.icon) {
    width: 1.5em;
    height: 1.5em;
    cursor: pointer;
  }
}
.img {
  height: 200px;
  width: 200px;
  margin-bottom: 20px;
}
p {
  font-size: 16px;
  color: white;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
h1 {
  color: white;
}
b {
  margin-left: 4px;
  font-size: 12px;
  text-decoration: underline;
  font-style: oblique;
  cursor: pointer;
}
.title {
  width: 100%;
  text-align: center;
  font-size: 26px;
  position: relative;
  color: white;
  margin-bottom: 30px;
  margin-top: 20px;
}
.title::before {
  content: "";
  position: absolute;
  bottom: -5px;
  width: 0px;
  height: 3px;
  background-color: white;
  transition: 0.5s;
}
.title:hover:before {
  width: 156px;
}
.icon-wx {
  width: 20px !important;
  height: 20px !important;
  //   vertical-align: -7px;
  //   margin-right: 3px;
}
img {
  width: 200px;
  height: 200px;
}
</style>
